export class EventBus {
  constructor (Vue) {
    let raw = new Vue()
    this.raw = raw
  }

  on () {
    this.raw.$on.apply(this.raw, arguments)
  }

  off () {
    this.raw.$off.apply(this.raw, arguments)
  }

  trigger () {
    this.raw.$emit.apply(this.raw, arguments)
  }

  emit () {
    this.raw.$emit.apply(this.raw, arguments)
  }
}

export let event

function install (Vue) {
  event = new EventBus(Vue)
  Vue.prototype.$event = event
}

export default {
  install,
  event
}
